<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
    [
      '<p>In the block below, the second "bar " should be selected.</p>',
      '<div style="width: 50px">foo bar <span>bar</span> baz</div>'
    ],
    selection => {
      const document = selection.document;
      document.execCommand('FindString', false, 'bar ');
      document.execCommand('FindString', false, 'bar ');
      document.execCommand('FindString', false, 'bar ');
    },
    [
      '<p>In the block below, the second "bar " should be selected.</p>',
      '<div style="width: 50px">foo bar <span>^bar</span> |baz</div>'
    ].join(''),
    'execCommand findString');
</script>
